package com.jrzh.mvc.convert.sys;

import org.springframework.stereotype.Component;

import com.jrzh.common.exception.ProjectException;
import com.jrzh.framework.base.convert.BaseConvertI;
import com.jrzh.mvc.model.sys.UserSettingModel;
import com.jrzh.mvc.view.sys.UserSettingView;
@Component("userSettingConvert")
public class UserSettingConvert implements BaseConvertI<UserSettingModel, UserSettingView>{

	@Override
	public UserSettingModel addConvert(UserSettingView view) throws ProjectException {
		UserSettingModel model = new UserSettingModel();
		model.setUserId(view.getUserId());
		model.setKey(view.getKey());
		model.setValue(view.getValue());
		model.setRemark(view.getRemark());
		return model;
	}

	@Override
	public UserSettingModel editConvert(UserSettingView view, UserSettingModel model) throws ProjectException {
		model.setUserId(view.getUserId());
		model.setKey(view.getKey());
		model.setValue(view.getValue());
		model.setRemark(view.getRemark());
		return model;
	}

	@Override
	public UserSettingView convertToView(UserSettingModel model) throws ProjectException {
		UserSettingView view = new UserSettingView();
		view.setId(model.getId());
		view.setUserId(model.getUserId());
		view.setKey(model.getKey());
		view.setValue(model.getValue());
		view.setRemark(model.getRemark());
		return view;
	}

}
